package com.mengye.control.courseInfo;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mengye.bean.CourseInfoBean;
import com.mengye.control.LoginControl;
import com.mengye.model.CourseInfoModel;
import com.mengye.utils.EasyFactory;
import com.mengye.utils.MyUtils;



/**
 * Servlet implementation class UserInfoSavingControl
 */
@WebServlet("/CourseInfoAddControl")
public class CourseInfoAddControl extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		CourseInfoBean courseInfoB = MyUtils.convertRequest2BeanWithFileUpload(request, CourseInfoBean.class);
		courseInfoB.setT_id(LoginControl.user_name);
		int i = EasyFactory.getNewInstance(CourseInfoModel.class).saveCourseInfo(courseInfoB);
		
		// 根据业务逻辑处理结果，进行结果页面的转发处理
				if(i >0) {
					// 新增成功
					// 返回响应内容
					response.getWriter().write("ok");
				}else {
					// 新增失败
					response.getWriter().write("no");
				}
		
	}

	
}
